package org.netty.push.server.message;

import org.netty.push.appinfo.service.AppInfoService;
import org.netty.push.core.proto.handler.MessageHandlerManager;
import org.netty.push.server.message.handler.ConnectRequestHandler;
import org.netty.push.server.message.handler.DataRequestHandler;
import org.netty.push.server.message.handler.DefaultMessageHanderManger;
import org.netty.push.utils.ApplicationContextHolder;

public class HandlerManagerFactory {
		
	private HandlerManagerFactory() {}
	
	public static  MessageHandlerManager buildHandler() {
		AppInfoService appInfoService=ApplicationContextHolder.getApplicationContext().getBean(AppInfoService.class);
		
		MessageHandlerManager messageHandlerManager=new DefaultMessageHanderManger();
		messageHandlerManager.getMessageHander().add(new ConnectRequestHandler(appInfoService ) );
		messageHandlerManager.getMessageHander().add(new DataRequestHandler() );
		return messageHandlerManager;
	}
}
